package com.study;

import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @Name: DataObject
 * @Description: java类作用描述
 * @Author: yn
 * @CreateDate: 2023/2/9 16:43
 * @Remark: 特殊说明
 * @Version: 1.0
 */
public class DataObject {
	private String id;
	private String type;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	private String title;
	private List<Relation> relations=new ArrayList<>();
	private List<DataObject> children=new ArrayList<>();
	private JSONObject data;

	public String getId() {
		return id;
	}

	public List<Relation> getRelations() {
		return relations;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public List<DataObject> getChildren() {
		return children;
	}

	public void setData(JSONObject data) {
		this.data = data;
	}

	public void addRelation(String id,String type,String childId, String childType){
		relations.add(new Relation(id,type,childId,childType));
	}

	public void addChildren(DataObject dataObject){
		children.add(dataObject);
	}

	class Relation{
		private String id;
		private String childId;
		private String type;
		private String childType;

		public Relation(String id, String type,String childId, String childType) {
			this.id = id;
			this.childId = childId;
			this.type = type;
			this.childType = childType;
		}

		public String getChildId() {
			return childId;
		}

		public String getChildType() {
			return childType;
		}

		public String getId() {
			return id;
		}
		public String getType() {
			return type;
		}
	}
}
